import { BaseEntity } from '../../base/entity/base';
import { Column, Entity, Index } from 'typeorm';

/**
 * 报警设置
 */
@Entity('device_alert')
export class DeviceAlertEntity extends BaseEntity {
  @Column({ comment: '触发温度阈值', type: 'decimal', precision: 5, scale: 2, nullable: true })
  temperatureThreshold: number;

  @Column({ comment: '报警间隔时间（分钟）', nullable: true })
  interval: number;

  @Column({ comment: '报警方式', type: 'json', nullable: true })
  alertMethod: number[];

  @Column({ comment: '静默时间段', nullable: true })
  silentPeriod: string;

  @Index()
  @Column({ comment: '所属设备ID', nullable: true })
  deviceId: number;
}